﻿<%@ Page Title="收货地址" Language="C#" MasterPageFile="~/Member/MemberMaster.master" AutoEventWireup="true" CodeFile="Shop_ReceiveAddress.aspx.cs" Inherits="Member_Shop_ReceiveAddress" %>
<%@ Import Namespace="HKB.Common.HKB.Common" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
        <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <div class="grxixn b">
          	<div class="ninhao">
            	<p>您好：<asp:Label ID="lblUserName" runat="server" CssClass="red"></asp:Label>，欢迎进入用户中心，您目前购物车有 <asp:Label ID="lblShopCarNum" runat="server" Text="Label" CssClass="red2"></asp:Label> 款产品未购买，<asp:Label ID="Buyer_Order" runat="server" Text="Label" CssClass="red2"></asp:Label> 笔订单正在进行中。</p>
            </div>
            
            <div class="xixzhil">
            	<h2>收货地址</h2>
            </div>
            <div class="xi_xqing b autohei">
               	<div class="xhtianjia"><p><strong class="red">> 添加新收货地址</strong> （电话号码、手机号选填一项,其余均为必填项）</p><span>
                       <asp:ImageButton ID="ibtn" runat="server" ImageUrl="/images/grxx_t2.png" 
                        onclick="ibtn_Click" OnClientClick="return Check()" /></span></div>
                    <div class="ximriqi">
                    	<ul>
                        	<li><strong>收货人:</strong> <input id="UserName" runat="server" type="text" class="xm1"/> <span class="red">*</span><asp:HiddenField
                                ID="hfldId" runat="server" />
                            </li>
                            <li><asp:UpdatePanel ID="UpdatePanel1" runat="server">
                            <ContentTemplate><strong>联系地址:</strong><asp:DropDownList ID="Province" runat="server" AutoPostBack="True" DataTextField="Province"
                            DataValueField="Province" AppendDataBoundItems="True" CssClass="gx_lb1" OnSelectedIndexChanged="SelectCity">
                            <asp:ListItem Value="" Text="所在地" />
                        </asp:DropDownList>-
                                <asp:DropDownList ID="City" runat="server" AutoPostBack="true" DataValueField="City"
                                    DataTextField="City" OnSelectedIndexChanged="SelectArea" CssClass="gx_lb1">
                                </asp:DropDownList>-
                                <asp:DropDownList ID="ddlArea" runat="server" DataTextField="Area" DataValueField="Area" CssClass="gx_lb1">
                                </asp:DropDownList>
                            </ContentTemplate>
                            <Triggers>
                                <asp:AsyncPostBackTrigger ControlID="Province" EventName="SelectedIndexChanged">
                                </asp:AsyncPostBackTrigger>
                                <asp:AsyncPostBackTrigger ControlID="City" EventName="SelectedIndexChanged"></asp:AsyncPostBackTrigger>
                            </Triggers>
                        </asp:UpdatePanel></li>
                            <li><strong>&nbsp;</strong><input id="Address" runat="server" type="text" class="dk1"/> <span class="red">*</span></li>
                            <li><strong>邮编:</strong><input id="ZipCode" runat="server" type="text" class="xm1"/> <span class="red">*</span></li>
                            <li><strong>移动电话: </strong><input id="MobilePhone" runat="server" type="text" class="xm1"/> <span class="red">*</span></li>
                            <li><strong>固定电话: </strong><input id="ConectPhone" runat="server" type="text" class="xm1"/></li>
                        </ul>
                    </div>
            </div>
            <div class="shoudozhi autohei">
            	<h3 class="red"><strong>> 已保存的有效的收货地址</strong></h3>
                <ul>
                    <asp:Repeater ID="Repeater1" runat="server" 
                        onitemcommand="Repeater1_ItemCommand" 
                        onitemdatabound="Repeater1_ItemDataBound">
                        <ItemTemplate>
                        <li <%#(Eval("IsDefault").ToString().Equals("1"))?"class='hover'":""%>><h4 class="red2">地址<%#ChineseNum.GetChineseNum((Container.ItemIndex + 1).ToString())%>：</h4>
                    	<p><%#Eval("Province") %><%#Eval("City") %><%#Eval("CMArea") %><%#Eval("Address")%><br />
<%#Eval("username")%>（收） <%#Eval("MobilePhone")%> </p>
<div class="moxiug"><span>
    <asp:LinkButton ID="lbtnEdit" runat="server" CommandName="Edit">修改</asp:LinkButton>|<asp:LinkButton ID="lbtnDel" runat="server" CommandName="Delete">删除</asp:LinkButton> </span>
    <asp:RadioButton ID="IsDefault" runat="server" AutoPostBack="True" OnCheckedChanged="SetDefaultAddress_CheckedChanged" />	默认地址 
    <asp:HiddenField ID="hfldAddressId" runat="server" Value='<%#Eval("AddressID") %>' />
</div>
                    </li>
                        </ItemTemplate>
                    </asp:Repeater>
                </ul>
                <div align="left" style="padding-top:20px;">最多保存<asp:Literal runat="server" ID="Addrnum" Text="10" />个有效地址</div>
            </div>
          </div>
    <script type="text/javascript">
        $().ready(function () {
            $("#lm3,#lm33").addClass("red");
        });
        
        function Check() {
            var ErrorNum = 0;
            var ErrorInfo = '请填写以下内容:\r\n';
            if ($('#<%=UserName.ClientID %>').val() == "") {
                ErrorNum++;
                ErrorInfo += ErrorNum + '. 收货人不能为空.\r\n';
            }
            
            if ($('#<%=Address.ClientID %>').val() == "") {
                ErrorNum++;
                ErrorInfo += ErrorNum + '. 联系地址不能为空.\r\n';
            }
            if ($('#<%=ZipCode.ClientID %>').val() == "") {
                ErrorNum++;
                ErrorInfo += ErrorNum + '. 邮编不能为空.\r\n';
            } else if (!$('#<%=ZipCode.ClientID %>').val().match(/\d{6}/)) {
                ErrorNum++;
                ErrorInfo += ErrorNum + '. 邮政编码格式不对.\r\n';
            }
            if ($('#<%=MobilePhone.ClientID %>').val() == "" && $('#<%=ConectPhone.ClientID %>').val() == "") {
                ErrorNum++;
                ErrorInfo += ErrorNum + '. 移动电话、固定电话必须输入一项.\r\n';
            } else if (!$('#<%=MobilePhone.ClientID %>').val().match(/^(13[0-9]|15[^4]|18[6|8|9])\d{8}$/)) {
                ErrorNum++;
                ErrorInfo += ErrorNum + '. 移动电话格式不对.\r\n';
            }
            if (ErrorNum == 0) {
                return true;
            } else {
                alert(ErrorInfo);
                return false;
            }
        }
    </script>
</asp:Content>

